home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / axpcklst / contxtid.bas < prev    next >
BASIC Source File  |  1998-08-01  |  10KB  |  232 lines

  1. Option Explicit
  2. '=====================================================================
  3. '=====================================================================
  4. '
  5. 'This source code contains the following routines:
  6. '  o SetAppHelp() 'Called in the main Form_Load event to register your
  7. '                 'program with WINHELP.EXE
  8. '  o QuitHelp()    'Deregisters your program with WINHELP.EXE. Should
  9. '                  'be called in your main Form_Unload event
  10. '  o ShowHelpTopic(Topicnum) 'Brings up context sensitive help based on
  11. '                  'any of the following CONTEXT IDs
  12. '  o ShowContents  'Displays the startup topic
  13. '  o HelpWindowSize(x,y,dx,dy) ' Position help window in a screen
  14. '                              ' independent manner
  15. '  o SearchHelp()  'Brings up the windows help KEYWORD SEARCH dialog box
  16. '***********************************************************************
  17. '
  18. '=====================================================================
  19. 'List of Context IDs for <axPicker>
  20. '=====================================================================
  21. Global Const Hlp_Contents = 10    'Main Help Window
  22. Global Const Hlp_Revisions = 30    'Main Help Window
  23. Global Const Hlp_License = 40    'Main Help Window
  24. Global Const Hlp_Tech_Support = 50    'Main Help Window
  25. Global Const Hlp_Properties = 60    'Main Help Window
  26. Global Const Hlp_Methods = 70    'Main Help Window
  27. Global Const Hlp_Events = 80    'Main Help Window
  28. Global Const Hlp_Installation = 90    'Main Help Window
  29. '=====================================================================
  30. '
  31. '
  32. '  Help engine section.
  33.  
  34. ' Commands to pass WinHelp()
  35. Global Const HELP_CONTEXT = &H1 '  Display topic in ulTopic
  36. Global Const HELP_QUIT = &H2    '  Terminate help
  37. Global Const HELP_FINDER = &HB  '  Display Contents tab
  38. Global Const HELP_INDEX = &H3   '  Display index
  39. Global Const HELP_HELPONHELP = &H4      '  Display help on using help
  40. Global Const HELP_SETINDEX = &H5        '  Set the current Index for multi index help
  41. Global Const HELP_KEY = &H101           '  Display topic for keyword in offabData
  42. Global Const HELP_MULTIKEY = &H201
  43. Global Const HELP_CONTENTS = &H3     ' Display Help for a particular topic
  44. Global Const HELP_SETCONTENTS = &H5  ' Display Help contents topic
  45. Global Const HELP_CONTEXTPOPUP = &H8 ' Display Help topic in popup window
  46. Global Const HELP_FORCEFILE = &H9    ' Ensure correct Help file is displayed
  47. Global Const HELP_COMMAND = &H102    ' Execute Help macro
  48. Global Const HELP_PARTIALKEY = &H105 ' Display topic found in keyword list
  49. Global Const HELP_SETWINPOS = &H203  ' Display and position Help window
  50.  
  51.  
  52. Type HELPWININFO
  53.   wStructSize As Integer
  54.   X As Integer
  55.   Y As Integer
  56.   dX As Integer
  57.   dY As Integer
  58.   wMax As Integer
  59.   rgChMember As String * 2
  60. End Type
  61.     Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData As Any) As Integer
  62.     Declare Function WinHelpByInfo Lib "User" Alias "WinHelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As HELPWININFO) As Integer
  63.     Declare Function WinHelpByStr Lib "User" Alias "Winhelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData$) As Integer
  64.     Declare Function WinHelpByNum Lib "User" Alias "Winhelp" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, ByVal dwData&) As Integer
  65.  
  66.     Dim m_hWndMainWindow as Integer ' hWnd to tell WINHELP the helpfile owner
  67. Dim MainWindowInfo as HELPWININFO
  68. Sub SetAppHelp (ByVal hWndMainWindow)
  69. '=====================================================================
  70. 'To use these subroutines to access WINHELP, you need to add
  71. 'at least this one subroutine call to your code
  72. '     o  In the Form_Load event of your main Form enter:
  73. '        Call SetAppHelp(Me.hWnd) 'To setup helpfile variables
  74. '         (If you are not interested in keyword searching or context
  75. '         sensitive help, this is the only call you need to make!)
  76. '=====================================================================
  77.     m_hWndMainWindow = hWndMainWindow
  78.     If Right$(Trim$(App.Path),1) = "\" then
  79.         App.HelpFile = App.Path + "axPicker.HLP"
  80.     else
  81.         App.HelpFile = App.Path + "\axPicker.HLP"
  82.     end if
  83. MainWindowInfo.wStructSize = 14
  84.     MainWindowInfo.X=256
  85.     MainWindowInfo.Y=256
  86.     MainWindowInfo.dX=512
  87.     MainWindowInfo.dY=512
  88.     MainWindowInfo.rgChMember=Chr$(0)+Chr$(0)
  89. End Sub
  90. Sub QuitHelp ()
  91.     Dim Result as Variant
  92.     Result = WinHelp(m_hWndMainWindow, App.HelpFile, HELP_QUIT, Chr$(0) + Chr$(0) + Chr$(0) + Chr$(0))
  93. End Sub
  94. Sub ShowHelpTopic (ByVal ContextID As Long)
  95. '=====================================================================
  96. '  FOR CONTEXT SENSITIVE HELP IN RESPONSE TO A COMMAND BUTTON ...
  97. '=====================================================================
  98. '     o   For 'Help button' controls, you can call:
  99. '         Call ShowHelpTopic(<any Hlpxxx entry above>)
  100. '=====================================================================
  101. '  TO ADD FORM LEVEL CONTEXT SENSITIVE HELP...
  102. '=====================================================================
  103. '     o  For FORM level context sensetive help, you should set each 
  104. '        Me.HelpContext=<any Hlp_xxx entry above>
  105. '
  106.     Dim Result as Variant
  107.  
  108.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(ContextID))
  109.  
  110. End Sub
  111. Sub ShowHelpTopic2 (ByVal ContextID As Long)
  112. '=====================================================================
  113. '  DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 2 ...
  114. '=====================================================================
  115. '     o   For 'Help button' controls, you can call:
  116. '         Call ShowHelpTopic2(<any Hlpxxx entry above>)
  117. '
  118.     Dim Result as Variant
  119.  
  120.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd02", HELP_CONTEXT, Clng(ContextID))
  121.  
  122. End Sub
  123. Sub ShowHelpTopic3 (ByVal ContextID As Long)
  124. '=====================================================================
  125. '  DISPLAY CONTEXT SENSITIVE HELP IN WINDOW 3 ...
  126. '=====================================================================
  127. '     o   For 'Help button' controls, you can call:
  128. '         Call ShowHelpTopic3(<any Hlpxxx entry above>)
  129. '
  130.     Dim Result as Variant
  131.  
  132.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile &">HlpWnd03", HELP_CONTEXT, Clng(ContextID))
  133.  
  134. End Sub
  135. Sub ShowGlossary ()
  136.     Dim Result as Variant
  137.  
  138.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXT, Clng(64000))
  139.  
  140. End Sub
  141. Sub ShowPopupHelp (ByVal ContextID As Long)
  142. '=====================================================================
  143. '  FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
  144. '=====================================================================
  145.     Dim Result as Variant
  146.  
  147.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTEXTPOPUP, Clng(ContextID))
  148.  
  149. End Sub
  150. Sub DoHelpMacro (ByVal MacroString As String)
  151. '=====================================================================
  152. '  FOR POPUP HELP IN RESPONSE TO A COMMAND BUTTON ...
  153. '=====================================================================
  154.     Dim Result as Variant
  155.  
  156.     Result = WinHelpByStr(m_hWndMainWindow, APP.HelpFile, HELP_COMMAND, ByVal(Macrostring))
  157.  
  158. End Sub
  159. Sub ShowHelpContents ()
  160. '=====================================================================
  161. '  DISPLAY STARTUP TOPIC IN RESPONSE TO A COMMAND BUTTON or MENU ...
  162. '=====================================================================
  163. '
  164.     Dim Result as Variant
  165.  
  166.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_CONTENTS, Clng(0))
  167.  
  168. End Sub
  169. Sub ShowContentsTab ()
  170. '=====================================================================
  171. '  DISPLAY Contents tab (*.CNT)
  172. '=====================================================================
  173. '
  174.     Dim Result as Variant
  175.  
  176.     Result = WinHelpByNum(m_hWndMainWindow, APP.HelpFile, HELP_FINDER, Clng(0))
  177.  
  178. End Sub
  179. Sub ShowHelpOnHelp ()
  180. '==============================================